package com.data.biz.constant;

import java.util.Objects;

public enum FunctionTypeEnum {
    DIP("倾角", "DIP",1),
    ACC("加速度", "ACC",2);

    // 成员变量
    private String name;
    private String index;
    private Integer id;
    // 构造方法
    private FunctionTypeEnum(String name, String index,Integer id) {
        this.name = name;
        this.index = index;
        this.id = id;
    }
    // 普通方法
    public static String getNameById(Integer id) {
        for (FunctionTypeEnum c : FunctionTypeEnum.values()) {
            if (Objects.equals(c.getId(), id)) {
                return c.name;
            }
        }
        return null;
    }


    public static Integer getIdByIndex(String index) {
        for (FunctionTypeEnum c : FunctionTypeEnum.values()) {
            if (Objects.equals(c.getIndex(), index)) {
                return c.id;
            }
        }
        return null;
    }

    public static String getIndexById(Integer id) {
        for (FunctionTypeEnum c : FunctionTypeEnum.values()) {
            if (Objects.equals(c.getId(), id)) {
                return c.index;
            }
        }
        return null;
    }
    // get set 方法
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIndex() {
        return index;
    }
    public void setIndex(String index) {
        this.index = index;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
}
